//
//  receiverCell.m
//  XDLookPic
//
//  Created by XD-XY on 5/26/14.
//  Copyright (c) 2014 XD-XY. All rights reserved.
//

#import "ReceiverCell.h"
#import "XDHeader.h"
#import "XDTools.h"

@implementation ReceiverCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        
        [self makeViews];
    }
    return self;
}

-(void)makeViews
{

// CGRectMake(12.0f, 11.0f, 320-23.5, 165.0f);
    self.backgroundColor = [UIColor clearColor];

    self.nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(12+19, 11+15, 62, 20)];
    _nameLabel.backgroundColor = [UIColor clearColor];
    _nameLabel.font = [UIFont systemFontOfSize:15];
    _nameLabel.textColor = UIColorFromRGB(0x666666);

    self.phoneLabel = [[UILabel alloc] initWithFrame:CGRectMake(width_x(_nameLabel)+19,_nameLabel.frame.origin.y, 135, 20)];
    _phoneLabel.backgroundColor = [UIColor clearColor];
    _phoneLabel.font = [UIFont systemFontOfSize:15];
    _phoneLabel.textColor = UIColorFromRGB(0x666666);
    
    
    self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(_nameLabel.frame.origin.x, height_y(_nameLabel)+2,  528/2.0f, 20)];
    _addressLabel.backgroundColor = [UIColor clearColor];
    _addressLabel.font = [UIFont systemFontOfSize:12];
    _addressLabel.textColor = UIColorFromRGB(0x777777);
 
    
    self.editBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _editBtn.frame = CGRectMake(452/2.0f-11/2.0f, 156/2.0f-11/2.0f, 23+11, 23+11);
    [_editBtn setImage:[UIImage imageNamed:@"receiverEdit_nor"] forState:UIControlStateNormal];
    [_editBtn setImage:[UIImage imageNamed:@"receiverEdit_sel"] forState:UIControlStateHighlighted];
    _editBtn.backgroundColor = [UIColor clearColor];
    
    self.tLabel = [[UILabel alloc] initWithFrame:CGRectMake(width_x(_editBtn), _editBtn.frame.origin.y+3, 30, _editBtn.frame.size.height-3)];
    _tLabel.backgroundColor = [UIColor clearColor];
    _tLabel.textColor = RGBA(51, 51, 51, 1);
    _tLabel.font = [UIFont systemFontOfSize:15];
    _tLabel.text = @"编辑";
    _tLabel.textColor = UIColorFromRGB(0x666666);
    
    self.rEditBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    _rEditBtn.frame = CGRectMake(_editBtn.frame.origin.x, _editBtn.frame.origin.y, 34+30, 34);
    _rEditBtn.backgroundColor = [UIColor clearColor];
    
    [self.contentView addSubview:_nameLabel];
    [self.contentView addSubview:_phoneLabel];
    [self.contentView addSubview:_addressLabel];
    [self.contentView addSubview:_editBtn];
    [self.contentView addSubview:_tLabel];
    [self.contentView addSubview:_rEditBtn];
    
    //cell未选中效果
    self.disSelectBg = [[UIImageView alloc] init];
    _disSelectBg.frame = CGRectMake(0, 0, self.frame.size.width,self.frame.size.height);
//    _disSelectBg.image = [UIImage imageNamed:@"receiver_cell_nor"];
    UIImage * image = [UIImage imageNamed:@"receiver_cell_nor"];
     image = [image resizableImageWithCapInsets:UIEdgeInsetsMake(60,40,50,40)];
    _disSelectBg.image = image;
    self.backgroundView = _disSelectBg;
    
    //cell选中效果
    self.selectBg = [[UIImageView alloc] init];
    _selectBg.frame = CGRectMake(0, 0, self.frame.size.width,self.frame.size.height);
//    _selectBg.image = [UIImage imageNamed:@"receiver_cell_sel"];
    UIImage * image2 = [UIImage imageNamed:@"receiver_cell_sel"];
    image2 = [image2 resizableImageWithCapInsets:UIEdgeInsetsMake(60,40,50,40)];
    _selectBg.image = image2;
    self.selectedBackgroundView = _selectBg;
}

- (void)awakeFromNib
{
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


@end
